/**
 * FileName: ApplicationOrder
 * Author:   杨兴
 * Date:     2019/8/14 10:13
 * Description: 订单服务启动
 */
package com.xiongmao.gongyu;

import com.zaxxer.hikari.HikariDataSource;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

import javax.sql.DataSource;

@EnableEurekaClient
@SpringBootApplication
@EnableFeignClients
@EnableHystrix
@MapperScan("com.xiongmao.gongyu.mybatis")
@Configuration
public class ApplicationMember2 {
    public static void main(String[] args){
        SpringApplication.run(ApplicationMember2.class,args);
    }

    @Bean
    @RefreshScope
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSource dataSource0() {
//        DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource();
//        driverManagerDataSource.setDriverClassName("com.mysql.jdbc.Driver");
//        driverManagerDataSource.setUrl("jdbc:mysql://192.168.0.160:3307/test");
//        driverManagerDataSource.setUsername("mysql");
//        driverManagerDataSource.setPassword("mysql1a2s");
        return DataSourceBuilder.create().build();


    }
}
